<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆页面</title>
    <link href="../static/css/style.css" rel="stylesheet" media="screen">
    <link href="../static/css/reset.css" rel="stylesheet" type="text/css"/>
    <link href="../static/layui/css/layui.css" rel="stylesheet" type="text/css" />

</head>
<body>
<div id="particles-js">
    <form class="login layui-form">
        <div class="login-top">
            登录
        </div>
        <div class="login-center clearfix">
            <!--隐藏的属性 ,默认值是 登录-->
            <!--<input type="hidden" name="service" value="login" />-->
            <div class="login-center-img">
                <!--<img src="../static/img/name.png"/>-->
            </div>
            <div class="login-center-input">
                <input type="text" name="username"  placeholder="用户名" onfocus="this.placeholder=''" onblur="this.placeholder='请输入您的用户名'"/>
                <div class="login-center-input-text">用户名</div>
            </div>
        </div>
        <div class="login-center clearfix">
            <div class="login-center-img">
                <!--<img src="../static/img/password.png"/>-->
            </div>
            <div class="login-center-input">
                <input type="password" name="password" placeholder="用户密码" onfocus="this.placeholder=''" onblur="this.placeholder='请输入您的密码'"/>
                <div class="login-center-input-text">密码</div>
            </div>
        </div>
        <div class="login-center clearfix">
            <div class="login-center-img">
                <!--<img src="../static/img/password.png"/>-->
            </div>
            <div class="login-center-input">
                <input type="text" name="checkCode" placeholder="验证码"  style="width: 120px"/>
                <div class="login-center-input-text">验证码</div>
                <img id="checkCode" alt="验证码" src="/tester/checkCode" style="width: 70px;margin-left: 20px">
            </div>
        </div>
        <button class="login-button" lay-submit lay-filter="loginBtnFilter">
            登录
        </button>

    </form>
    <div class="sk-rotating-plane"></div>
</div>
<div style="text-align:center;">
</div>

<script src="../static/layui/layui.js"></script>
<!--登录页调整星空粒子间隔,坐标...-->
<script src="../static/js/particles.min.js"></script>
<script src="../static/js/app.js"></script>
<script>
    layui.use(['form','layer','jquery'], function(){
        var form = layui.form;
        var layer = layui.layer;
        var $ = layui.jquery;
        //监听提交
        form.on('submit(loginBtnFilter)', function(d){
            $.post('/tester/login',d.field,function (rs) {
                if(rs.type=='success'){
                    layer.msg(rs.msg);
                    location.href='/run/toindex';    //后台首页
                    return false;
                }
                //登陆失败提示信息
                layer.msg(rs.msg);
                //刷新验证码
                $("#checkCode").click();
                $("input[name='checkCode']").val("");//清空之前输入框的数据
            });
            return false;//阻止表单默认提交
        });
        //验证码点击事件
        $("#checkCode").click(function () {
            $(this).attr("src","/tester/checkCode?"+new Date());
        });
    });
</script>
</body>
</html>









